package com.raycloud.dingtalk.starter.handle;

import org.apache.commons.cli.Option;

import java.util.Map;

/**
 * 业务自定义抽象行为
 * -a aliid  -s shopId
 */
public abstract class AbstractRelationCommandHandle extends AbstractMapOptionCommandHandle {
    @Override
    public String handle(Map<String, Option> optionMap) {
        Option aliId = optionMap.get("aliId");
        Option shopId = optionMap.get("shopId");
        if (aliId == null) {
            return "miss -a or -aliId";
        }
        if (shopId == null) {
            return "miss -s or -shopId";
        }
        return handle(Long.parseLong(aliId.getValue()), Long.parseLong(shopId.getValue()), optionMap);
    }

    public abstract String handle(Long companyId, Long shopId, Map<String, Option> optionMap);
}
